#ifndef _BSP_DISPLAY_H
#define _BSP_DISPLAY_H
#include "driver/gpio.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/queue.h"


#define DISPLAY_UART_TX1_PORT GPIO_NUM_20
#define DISPLAY_UART_TX2_PORT GPIO_NUM_21



#define     LED_TM1652_DISPLAY_GRID1    0X08
#define     LED_TM1652_DISPLAY_GRID2    0X88
#define     LED_TM1652_DISPLAY_GRID3    0X48
#define     LED_TM1652_DISPLAY_GRID4    0XC8
#define     LED_TM1652_DISPLAY_GRID5    0X28
#define     LED_TM1652_DISPLAY_GRID6    0XA8
   
#define     LED_TM1652_MODESET_CMD      0X18        // 模式设置命令
#define     LED_TM1652_PARAMSET_DATA    0XFF        // 具体模式 电流电压等

union grid5_t{
    uint8_t grid5_byte;
    struct {
        uint8_t grid5_point:1;  
        uint8_t grid5_countdown:1;
        uint8_t grid5_mute:1;
        uint8_t grid5_voice1:1;
        uint8_t grid5_voice2:1;
        uint8_t grid5_voice3:1;
        uint8_t grid5_ble:1;
    }grid5_bit_t;
};

union grid6_t{
    uint8_t grid6_byte;
    struct {
        uint8_t grid6_wifi:1;  
        uint8_t grid6_reserved:6;  
    }grid6_bit_t;
};

union grid7_t{
    uint8_t grid7_byte;
    struct {
        uint8_t grid7_dlms1:1;  
        uint8_t grid7_dlms2:1;
        uint8_t grid7_dlms3:1;
        uint8_t grid7_dlms4:1;
        uint8_t grid7_dlms5:1;
        uint8_t grid7_dlms6:1;
        uint8_t grid7_dlms7:1; 
    }grid7_bit_t;
};

union grid8_t{
    uint8_t grid8_byte;
    struct {
        uint8_t grid8_dlms8:1;  
        uint8_t grid8_dlms9:1;  
        uint8_t grid8_ccqd3:1;  
        uint8_t grid8_ccqd2:1; 
        uint8_t grid8_ccqd1:1; 
        uint8_t grid8_ccqd:1; 
        uint8_t grid8_dlms:1; 
    }grid8_bit_t;
};

union grid9_t{
    uint8_t grid9_byte;
    struct {
        uint8_t grid9_dlqd1:1;
        uint8_t grid9_dlqd2:1;  
        uint8_t grid9_dlqd3:1;  
        uint8_t grid9_dlqd4:1;  
        uint8_t grid9_dlqd5:1;  
        uint8_t grid9_dlqd6:1;  
        uint8_t grid9_dlqd7:1;    

    }grid9_bit_t;
};

union grid10_t{
    uint8_t grid10_byte;
    struct {
        uint8_t grid10_dlqd8:1;    
        uint8_t grid10_dlqd9:1;   
        uint8_t grid10_dlqd:1;  
        uint8_t grid10_czfd:1; 
        uint8_t grid10_czfd1:1;
        uint8_t grid10_czfd2:1;
        uint8_t grid10_czfd3:1;

    }grid10_bit_t;
};

union grid11_t{
    uint8_t grid11_byte;
    struct {
        uint8_t grid11_dlpl1:1;   
        uint8_t grid11_dlpl2:1;  
        uint8_t grid11_dlpl3:1;  
        uint8_t grid11_dlpl4:1;  
        uint8_t grid11_dlpl5:1;  
        uint8_t grid11_dlpl6:1;  
        uint8_t grid11_dlpl7:1;   

    }grid11_bit_t;
};

union grid12_t{
    uint8_t grid12_byte;
    struct {
        uint8_t grid12_dlpl8:1;   
        uint8_t grid12_dlpl9:1; 
        uint8_t grid12_dlpl:1; 
        uint8_t grid12_czpl:1; 
        uint8_t grid12_czpl1:1; 
        uint8_t grid12_czpl2:1; 
        uint8_t grid12_czpl3:1; 
    }grid12_bit_t;
};

extern QueueHandle_t display_led_queue;
void display_init(void);
uint8_t *TM1652_led_datatrans(void *display_struct, uint8_t flash_status);
#endif 










